IProvider
ITxRunnerProvider
Only a subset of a IProvider
methods might be needed by a TxBuilderRunner
;
so here is the ITxRunnerProvider
interface:
interface ITxRunnerProvider extends
IGetGenesisInfos,
IResolveUTxOs,
IResolveDatumHashes,
Partial<IGetChangeAddress>
{}
ITxRunnerProvider
methods
optionally:
IProvider
definition:
interface IProvider extends
IGetGenesisInfos,
IGetProtocolParameters,
IResolveUTxOs,
IResolveDatumHashes,
ISubmitTx,
ISignTx,
Partial<IGetChangeAddress>
{}
IGetGenesisInfos
interface IGetGenesisInfos {
getGenesisInfos: () => Promise<GenesisInfos>
}
IGetProtocolParameters
interface IGetProtocolParameters {
getProtocolParameters: () => Promise<ProtocolParameters>
}
IResolveUTxOs
interface IResolveUTxOs {
resolveUtxos: ( utxos: CanResolveToUTxO[] ) => Promise<UTxO[]>,
}
IResolveDatumHashes
interface IResolveDatumHashes {
resolveDatumHashes: ( hashes: Hash32[] ) => Promise<{
hash: string,
datum: CanBeData
}[]>
}
ISubmitTx
interface ISubmitTx {
submitTx: ( txCBOR: string ) => Promise<string>
}
ISignTx
interface ISignTx {
signTx: ( txCBOR: string ) => Promise<string>
}
IGetChangeAddress
interface IGetChangeAddress {
getChangeAddress: () => Promise<AddressStr | Address>
}
methods
getGenesisInfos
returns: Promise
<GenesisInfos
>
used to query genesis infos if none are already present.
genesis infos are only needed in case invalidBefore
or invalidAfter
are used.
not needed otherwise.
getProtocolParameters
returns: Promise
<ProtocolParameters
>
utility method of a provider to query protocol parameters.
NOT REQUIRED by ITxRunnerProvider
;
resolveUtxos
argument: CanResolveToUTxO
[]
returns: Promise
<UTxO
[]>
given an array of utxo references to resolve expects an array of UTxO
s back.
A TxBuilderRunner
instance won't require this method
if the utxos needed:
resolveDatumHashes
argument: Hash32
[]; hashes of the datums to be resolved
returns: Promise
<{ hash: string
, datum: CanBeData
}[]>
given an array of datum hashes queries the respective datums.
only needed if no datum for a given hash is known.
A TxBuilderRunner
instance
won't require this method if all the datums are provided as Data
getChangeAddress
provides a default changeAddress
if none is specified.